package pac.Labor;
import java.util.Scanner;
public class LaborTest {
    public static void main(String[] args)
    {
        //Create Publisher.
        Scanner scanner = new Scanner(System.in);
        System.out.println("劳动委员的名字是：");
        String lname = scanner.nextLine();
        LaborLeader leader = new LaborLeader(lname);

        //Create Observers.
        int cnt = 0;
        while(true)
        {
            System.out.println("给" + lname + "添加成员(已有" + cnt + "位） (按q结束添加)：");
            String mname = scanner.nextLine();
            if(mname.equals("Q")|| mname.equals("q"))
                break;
            LaborMember member = new LaborMember(mname);
            leader.addObserver(member);
            cnt++;
        }

        //create labor tasks.
        String place;
        cnt = 1;
        while(true)
        {
            System.out.println("选择地点：(输入q结束)");
            place = scanner.nextLine();
            if(place == "q" || place == "Q")
                break;
            String name = "劳动任务" + cnt;
            leader.assignTask(new LaborTask(name,place));
            cnt++;
        }
        System.out.println("Byebye!");
    }
}
